package com.tansun.easycare.rule.ruleversion.service;

import java.util.List;
import java.util.Map;

import com.tansun.easycare.core.service.CrudService;
import com.tansun.easycare.rule.common.model.VersionModel;
import com.tansun.easycare.rule.exception.BizException;
import com.tansun.easycare.rule.rulemange.entity.RuleManage;
import com.tansun.easycare.rule.ruleversion.entity.RuleVersioninfo;

public interface RuleVersioninfoService extends CrudService<RuleVersioninfo> {

    /**
     * 查找版本信息
     */
    List<RuleVersioninfo> findVersionList(Map<String, Object> map);

    /**
     * 查询版本VO信息
     */
    List<VersionModel> findVersionModelList(Map<String, Object> map);
    
    List<VersionModel> findVersionModelList(String projectCode,String modelType,String code);

    /**
     * 查找已发布的规则项目
     */
    List<RuleVersioninfo> findPublishRuleList(String projectCode);

    /**
     * 获取更新规则集（用于规则流分支之前） 如没有这条记录就添加一条
     */
    RuleVersioninfo getEmptyRuelSet() throws Exception;

    /**
     * 查找发布版本
     */
    List<RuleVersioninfo> findPublishVersionList(RuleVersioninfo info) throws BizException;
    
    
    List<RuleVersioninfo> findNewPublishVersionList(RuleVersioninfo info) throws BizException;

    /**
     * 更新规则信息（在发布的时候讲 code+version更新成发布后最新的内容）
     */
    void updateRuleContent(RuleManage ruleManage) throws BizException;
    
    /**
     * 更新规则信息（更新成发布后最新的内容）
     */
    void update(RuleVersioninfo ruleVersioninfo) throws BizException;
    
	/**
	 * 查找当前版本的规则
	 * @param info
	 * @return
	 * @throws BizException
	 */
	public  List<RuleVersioninfo> findCurrVerList(RuleVersioninfo  info) throws BizException;
	/**
     * 查找挑战者信息
     */
	List<RuleVersioninfo> findChallengerInfo(Map<String, Object> map);


	List<RuleVersioninfo>  findRuleRefeVersion(Map<String,Object> map);


	List<String>   findRuleRefeCodes(Map<String,String> map);


	void updateIsValid(RuleVersioninfo ruleVersioninfo);
	
	Map<String,String>  findRuleRefeVerMap(String  projectCode);
	
	Map<String,String> findProjectRefeVersion(String  projectCode);
	/**
	 * 查找决策树引用模型
	 * @param projectCode
	 * @return
	 */
	public List<RuleVersioninfo> findProjectRefeList(String projectCode);
	
    
    void deleteByMutilVersion(RuleManage ruleManage, List<String> versions);

}
